package com.example.demo.service.impl;


import java.util.List;

import com.example.demo.dao.PermissionDao;
import com.example.demo.entity.Permission;
import com.example.demo.mapper.PermissionMapper;
import com.example.demo.service.PermissionService;
import com.example.demo.util.KeyUtil;

/**
 * 
 * @author Henry.Y
 * 2019年5月23日
 */
public class PermissionServiceImpl implements PermissionService {
	
	private PermissionMapper permissionDao= new PermissionDao();

	public Permission createPermission(Permission permission){
		permission.setPermissionId(KeyUtil.getRandomID());
		String sqlId= "com.example.demo.mapper.PermissionMapper.insertPermission";
		permissionDao.createPermission(sqlId, permission);
		return permission;
	}
	
	public int deletePermission(String id){
		String sqlId="com.example.demo.mapper.PermissionMapper.deletePermission";
		return permissionDao.deletePermission(sqlId,id);
	}
	
	
	public int deltePermissionByList(List<String> list){
		String sqlId ="com.example.demo.mapper.PermissionMapper.deltePermissionByList";
		return permissionDao.deltePermissionByList(sqlId, list);
	}
	
	public int deletePermissionTable(){
		String sqlId ="com.example.demo.mapper.PermissionMapper.deleteFullPermission";
		return permissionDao.deletePermissionTable(sqlId);
	}
}
